import {createRouter, createWebHashHistory} from 'vue-router'
/*
没有进行路由懒加载
import Home from "@/views/home.vue";
import Login from "@/views/order-for-goods.vue";
*/

const routes = [
    // 路由懒加载 指定魔法注释/*webpackChunkName:xxx*/分包时候的名字
    {
        path: "/",
        redirect: "/home"
    },
    // 当访问/path的时候展示Home组件
    {
        path: "/home", // 路径
        name: "home", //命名路由
        meta: {age: 10}, //路由元信息
        component: () => import(/*webpackChunkName:'home'*/"@/views/home/home.vue") //所展示的组件
    },
    // 当访问/login的时候展示Login组件
    {
        path: "/login",
        name: "login",
        meta: {age: 11},
        component: () => import(/*webpackChunkName:'login'*/"@/views/order-for-goods/order-for-goods.vue")
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})
export default router
